package codingPractice.xiaoHongShu;

import java.util.*;

/*
    有几组用户id，选两组，看能不能达到 不同 用户id数量是x的。
 */
public class Test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int T = sc.nextInt();
            for(int t=0;t<T;t++) {
                int n = sc.nextInt();
                int x = sc.nextInt();
                List<Set<String>> groups = new ArrayList<>();

                for(int i=0;i<n;i++) {
                    int mi = sc.nextInt();
                    Set<String> userSet = new HashSet<>();
                    for(int j=0;j<mi;j++) {
                        userSet.add(sc.next());
                    }
                    groups.add(userSet);
                }

                boolean found = false;
                for(int i=0;i<n && !found;i++) {
                    for(int j=i+1;j<n;j++) {
                        Set<String> unionSet = new HashSet<>(groups.get(i));
                        unionSet.addAll(groups.get(j));

                        if (unionSet.size() == x) {
                            System.out.println("YES");
                            System.out.println((i+1) + " " + (j+1));
                            found = true;
                            break;
                        }
                    }
                }

                if(!found) {
                    System.out.println("NO");
                }


            }
        }
    }
}
